Import MaxMod.ModPlayer

'EnableOpenALAudio()
'SetAudioDriver("openal")
'SetAudioDriver("freeaudio")
SetAudioDriver("directsound")

Local file$ = RequestFile( "", MusicExtensions() )
Graphics 320,40,0 ; Cls ; DrawText("loading please wait...",10,10) ; Flip
Local t:Int = MilliSecs()
Local Sound:TSound = LoadSound( file, True )
Print (MilliSecs()-t)+" millisecs"
Local Channel:TChannel = PlaySound(Sound)

Repeat
	Cls
	If KeyHit(KEY_R) ResumeChannel(Channel)
	If KeyHit(KEY_P) PauseChannel(Channel)
	If KeyHit(KEY_S) StopChannel(Channel)
	If ChannelPlaying(channel)
		DrawText("Playing...",10,10)
	Else
		DrawText("Stopped...",10,10)
	EndIf
	Flip
Until AppTerminate() Or KeyHit(KEY_ESCAPE)
